package io;

import java.awt.image.BufferedImage;
import java.io.*;

public class CopyDemo3 {

    public static void main(String[] args) throws IOException {
        /**
         * ,1024*100
         * 原始速度         89
         * 读取  100kb     53
         * 写出  100kb     59
         * 读取，写出 100kb 55
         */
        FileInputStream fis = new FileInputStream("image.png");
        BufferedInputStream bis = new BufferedInputStream(fis,1024*100);

        //输出
        FileOutputStream fos = new FileOutputStream("image_copy03.png");
        BufferedOutputStream bos = new BufferedOutputStream(fos,1024*100);

        int d;
        Long start = System.currentTimeMillis();
        while((d = bis.read())!=-1){
            bos.write(d);
        }

        long end = System.currentTimeMillis();
        System.out.println("耗时为："+(end-start));
        System.out.println("写出完毕！！！");

        bos.close();
        bis.close();
    }
}
